<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="resource/css/bootstrap.css">
    <script src="resource/js/jquery-3.2.1.js"></script>
    <script src="resource/js/bootstrap.js"></script>
    <script type="text/javascript" src="/resource/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
   <form action="/list" method="post" >
       <input type="hidden" name="pageNum">
      <a href="toadd"><input type="button" value="添加"></a>
       <select name="lx">
           <option value="">请选择</option>
           <option value="1">姓名</option>
           <option value="2">申请注册单位</option>
       </select>
       <input type="text" name="neirong" value="${a.neirong}">
       执业资格证书编号<input type="text" name="zigezhengid" value="${a.zigezhengid}">
       有效期:<input type="date" name="mintime" value='<fmt:formatDate value="${a.mintime}" pattern="yyyy-MM-dd"></fmt:formatDate>'>-
          <input type="date" name="maxtime" value='<fmt:formatDate value="${a.maxtime}" pattern="yyyy-MM-dd"></fmt:formatDate>'>-
       <input type="submit" value="搜索">
       <input type="button" value="批量删除" onclick="ps()"><br>
      <table class="table">
          <tr>
              <th></th>
              <th>编号</th>
              <th>姓名</th>
              <th>性别</th>
              <th>省市</th>
              <th>申请注册单位</th>
              <th>会计师分类编号</th>
              <th>职业资格证编号</th>
              <th>注册号</th>
              <th>有效期</th>
              <th>操作</th>
          </tr>
          <c:forEach items="${pg.list}" var="e">
              <tr>
                  <td><input type="checkbox" name="ck" value="${e.id}"> </td>
                  <td>${e.id}</td>
                  <td>${e.name}</td>
                  <td>${e.sex}</td>
                  <td>${e.city}</td>
                  <td>${e.danwei}</td>
                  <td>${e.shejishiid}</td>
                  <td>${e.zigezhengid}</td>
                  <td>${e.zhucehao}</td>
                  <td><fmt:formatDate value="${e.dtime}" pattern="yyyy-MM-dd"></fmt:formatDate> </td>
                  <td><a href="#">编辑</a></td>
              </tr>
          </c:forEach>
          <tr>
              <td colspan="11">
                  跳转到<input type="text" name="pageNums" >页
                  <input type="button" value="跳转" onclick="tz()">
                  <jsp:include page="/resource/common/pages.jsp"></jsp:include>
              </td>
          </tr>
      </table>
   </form>

<script>
    $("[name='lx']").val('${a.lx}')
    function goPage(pageNum){
        $("[name='pageNum']").val(pageNum);
        $("form").submit();
    }

    function tz(){
       var pageNum= $("[name='pageNums']").val();
       goPage(pageNum);
        $("[name='pageNums']").val(pageNum)
    }

    //批量删除
    function ps(){
        var arr=$("[name='ck']:checked").map(function(){
            return this.value
        }).get().join()
        if(confirm("确认要删除吗")){
            $.post("deleteByid",{arr:arr},function(msg){
                if(msg>0){
                    alert("删除成功");
                    location.reload()
                }else{
                    alert("删除失败")
                    location.reload()
                }
            })
        }
    }
</script>
</body>


</html>